home *** CD-ROM | disk | FTP | other *** search
- #include "crtlocal.h"
- #include <fcntl.h>
- #include <sys/syslimits.h>
- #include <string.h>
- #include <Events.h>
-
- struct crt_fd_tab crt_fd_tab[OPEN_MAX+1];
- long crt_parID;
- short crt_ioVRefNum;
-
- static char *default_environ[] = {"LOGNAME=jrrk",NULL};
-
- char **environ = default_environ;
-
- int _fmode = 0;
-
- int getdtablesize(void)
- {
- return OPEN_MAX;
- }
-
- int getpagesize(void)
- {
- return 8192;
- }
-
- char *getwd(char *fullname)
- {
- char *idx;
- char crt_defpath[256];
- OSErr err = 0;
- CInfoPBRec cPB;
- cPB.dirInfo.ioDrParID = crt_parID;
- crt_defpath[0] = 0;
- while ((cPB.dirInfo.ioDrParID != root_parID) && !err)
- {
- char tmp[256];
- strcpy(tmp,crt_defpath);
- /* get information about dir */
- cPB.hFileInfo.ioCompletion = (ProcPtr)0L;
- cPB.hFileInfo.ioNamePtr = (StringPtr)crt_defpath;
- cPB.hFileInfo.ioVRefNum = crt_ioVRefNum;
- cPB.hFileInfo.ioFDirIndex = -1;
- cPB.hFileInfo.ioDirID = cPB.dirInfo.ioDrParID;
-
- err = PBGetCatInfoSync(&cPB);
- strcpy(crt_defpath+1+*crt_defpath,tmp);
- crt_defpath[0] = '/';
- }
- if (!*crt_defpath) strcpy(crt_defpath, "/");
- if (fullname) strcpy(fullname, crt_defpath);
- else fullname = crt_defpath;
- return fullname;
- }
-
- int next_fd(int first)
- {
- int i;
- for (i = first; i < OPEN_MAX; i++)
- if (!crt_fd_tab[i].fd) return i;
- }
-
-